<%
//hi mc
//this page's js and jsp code can reference la_person_create.jsp and so on
%>
<script type="text/javascript">
	Yutil.useLoadingMessage();
	Yutil.en.enhance();
</script>

<%
		//session id 
		String userid = (String) session.getValue("user");
		//get all enterprises he owned
		List enterpriseList = EnterpriseService.$.getAllEnterprises();
		//if business manager select from manage
		//if business operator select from own
		if(null == enterpriseList) 
			enterpriseList = new ArrayList();
 %>

<fieldset>
	<legend>创建合同</legend>
	<form id="contract_form" action="contractCreate.do">
		<table align="left" >
			<tr>
				<th><font color="white">公司名称</font></th>
				<td>
					<select id="enterprise_name" name="enterprise_name">
						<%
							for(int i = 0 ; i < enterpriseList.size(); i++) {
							Enterprise enterprise = (Enterprise) enterpriseList.get(i);
							
						%>
						<option value="<%= enterprise.getEnterpriseId()%>"><%= enterprise.getName()%></option>
						<%
						   }
						%>
					</select>
				</td>
			</tr>
			<tr>
				<th><font color="white">联系人</font></th>
				<td>
					<input style="width:100%" type="text" id="contact" name="contact"/>
				</td>
			</tr>
				<tr>
				<th><font color="white">联系电话</font></th>
				<td>
					<input style="width:100%" type="text" id="contact_number" name="contact_number"/>
				</td>
			</tr>
				<tr>
				<th><font color="white">合同金额</font></th>
				<td>
					<input style="width:100%" type="text" id="contract_amount" name="contract_amount"/>
				</td>
			</tr>
				<tr>
				<th><font color="white">合同起始日期</font></th>
				<td>
					<input style="width:70%" type="text" id="starteddate" name="starteddate" class="date"/>
				</td>
			</tr>
				<tr>
				<th><font color="white">合同结束日期</font></th>
				<td>
					<input style="width:70%" type="text" id="duedate" name="duedate" class="date"/>
				</td>
			</tr>
			<tr>	
				<td>
					<input class='button' type="button" value="添加" onclick="addContract();">
					<input class='button' type="reset" value="重设">
					<input class='button' type="button" value="取消" onclick="actionPage('la_contract_list.jsp')">
				</td>
			</tr>
		</table>
	</form>
</fieldset>
<div id="add_Result">
</div>
<script type="text/javascript">
	addContract = function() {
		var contract_form = document.getElementById('contract_form');
		//must add the '/' 
		var url = "/" + "<%= LocalContants.PROJECT_NAME %>" + "/contractCreate.do";
		var pars = Form.serialize(contract_form);
		var myAjax = new Ajax.Updater('right',url,{method:'post',parameters: pars,evalScripts:true});
	}
</script>

<%@ page import="java.util.*" %>
<%@ page import="com.esms.bean.Enterprise" %>
<%@ page import="com.esms.struts.service.*" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>

